{% extends 'airshow/base.html' %}

{% block title %}区域管理 - 珠海航展数据管理系统{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>区域管理</h2>
    <a href="{% url 'airshow:area_add' %}" class="btn btn-primary">添加区域</a>
</div>

<div class="card">
    <div class="card-header">
        <h5>区域列表</h5>
    </div>
    <div class="card-body">
        {% if areas %}
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>名称</th>
                            <th>位置</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for area in areas %}
                            <tr>
                                <td>{{ area.area_id }}</td>
                                <td>{{ area.name }}</td>
                                <td>{{ area.location|default:"未设置"|truncatechars:50 }}</td>
                                <td>
                                    <a href="{% url 'airshow:area_edit' area.area_id %}" class="btn btn-sm btn-info">编辑</a>
                                    <a href="{% url 'airshow:area_delete' area.area_id %}" class="btn btn-sm btn-danger" onclick="return confirm('确定要删除这个区域吗？');">删除</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            <p class="text-center">暂无区域数据</p>
        {% endif %}
    </div>
</div>
{% endblock %} 